<?php
/**
* $Id: edit_article.php 148 2010-05-04 10:21:26Z bwanglei $
* 修改帖子页面
*/

include_once(dirname(__FILE__).'/init.php');

if (isset($_GET['a_id'])) $aid = $_GET['a_id'];	// 不管是 POST 和 GET 都可以取得
if ($_SERVER['REQUEST_METHOD']=='POST') {
	$title_article = $_POST['title_article'];
	$content_article = $_POST['content_article'];
	$query_edit_article = 'update `apf_article` set `content`="'.$content_article.'" where `id`='.$aid;
	$mysql_conn->query($query_edit_article);
	if ($mysql_conn->affected_rows!=1) {
		apf_msg('修改帖子失败！');
		die();
	} else {
		apf_msg('修改成功',apf_full_url());
		die();
	}
}
if (!$article = apf_get_article($aid)) {
	apf_msg('不能获取当前帖子'); die();
}
include_once(TEMP_ROOT_PATH.'/edit_article.php');
?>
